<{include file="admin/admin_head.html"}>
<body>
	<{include file="admin/admin_nav.html"}>
	<h1>滚动图片管理</h1>
	<div id="pic-list">
		<ul>
			<li class="list-head">
				<span>
					<input type="checkbox" id="check-all" />
				</span>
				<span>图片</span>
				<span>描述</span>
				<span>顺序</span>
				<span>操作</span>
			</li>
			<{if $list}>
			<{foreach from=$list item=pic}>
			<li>
				<span>
					<input type="checkbox" id="check-all" />
				</span>
				<span>
					<a href="<{$smarty.const.UPLOAD_URL}>images/adv/<{$pic.file_name}>" target="_blank"><img src="<{$smarty.const.UPLOAD_URL}>images/adv/<{$pic.file_name}>" style="width:96px; height:70px;" /></a>
				</span>
				<span><{$pic.description}></span>
				<span><{$pic.order}></span>
				<span>
					<a href="javascript:;" class="edit_pic" data="{pid:'<{$pic.id}>',desc:'<{$pic.description}>',order:'<{$pic.order}>'}">修改</a>
					<a href="advertise.php?action=delAdv&id=<{$pic.id}>&type=1" class="del_pic">删除</a>
				</span>
			</li>
			<{/foreach}>
			<{/if}>
		</ul>
	</div>
	<fieldset id="pic-from" name="pic-form">
	<legend>添加图片</legend>
	<form action="advertise.php" method="post" id="frm-edit" enctype="multipart/form-data">
		<span><label for="file">选择图片：</label><input name="file" type="file" /></span>
		<span><label for="description">图片描述：</label><input name="description" type="text" /></span>
		<span><label for="order">显示顺序：</label><input name="order" type="text" /></span>
		<span>
			<input name="submit" type="submit" value="提交" />
			<input type="hidden" name="type" value="<{$type}>" />
			<input type="hidden" name="id" value="null" />
			<input type="hidden" name="action" value="addAdv" />
		</span>
	</form>
	</fieldset>
<script type="text/javascript">
$(document).ready(function(){
	$(".edit_pic").click(function(){
		var data = eval("(" + $(this).attr("data") + ")");
		$("#frm-edit input[name=description]").val(data.desc);
		$("#frm-edit input[name=order]").val(data.order);
		$("#frm-edit input[name=action]").val("editAdv");
		$("#frm-edit input[name=id]").val(data.pid);
	})

	$(".del_pic").click(function(){
		return confirm("确定要删除该图片吗？");
	})
})
</script>
</body>
</html>